<cfset service = new lib.cfc.RemoteService() /> 

<cfhttp url="http://bit.ly/re61uE" method="get" getasbinary="yes" result="imgRequest" timeout="15" />

<cfif imgRequest.statusCode eq "200 OK">
	<cfset img = imgRequest.fileContent />
<cfelse>
	<cfset img = imageNew("",600,620) />
	<cfset imageDrawText(img, "Boo!", 225, 250, {size=72,style="bold"}) />
	<cfset imageDrawText(img, "Wifi not working!!", 15, 350, {size=72,style="bold"}) />
	<cfset img = toBinary(toBase64(img)) />
</cfif>


<cfset photo = new lib.cfc.Photo() /> 
<cfset photo.setJPG(img) />
<cfset photo.setLat("37.33215") />
<cfset photo.setLon("-122.03038") />

<cfset service.addPhoto(photo) />

<cfset photos = service.listPhotos() />

<cfset firstPhoto = photos[1] />

<cfoutput>
	<img src="http://maps.googleapis.com/maps/api/staticmap?center=#firstPhoto.getLat()#,#firstPhoto.getLon()#&zoom=15&size=600x620&sensor=false" />
</cfoutput>

<cfimage action="writeToBrowser" source="#firstPhoto.getJpg()#" />